package com.cs.paoyer.administration.util;

//import com.cs.beneficios.business.entity.AdministrationFacadeLocalLocal;
//import com.cs.beneficios.business.entity.AdministrationFacadeLocalLocalHome;
import javax.naming.Context;
import javax.rmi.PortableRemoteObject;

import com.cs.paoyer.common.ServiceLocator;
import com.cs.paoyer.administration.business.AdministrationFacade;
import com.cs.paoyer.administration.business.AdministrationFacadeHome;

public class AdministrationServiceLocator extends ServiceLocator
{
  public AdministrationServiceLocator()
  {
  }


  /**
   * Obtiene una referencia a la interfaz remota del facade del modulo de 
   * administracion
   *
   */
  public AdministrationFacade getAdministrationFacade() {

    AdministrationFacadeHome adminFacadeHome = null;
    Context          context = null;
    try 
		{
				context = getIASInitialContext();
				// Obtenemos la referencia a la interfaz home
        
        
        //adminFacadeHome = ( AdministrationFacadeLocalLocalHome )  context.lookup("java:comp/env/ejb/local/AdministrationFacadeLocal");
        //adminFacadeHome = ( AdministrationFacadeLocalLocalHome ) PortableRemoteObject.narrow
					//	( context.lookup("AdministrationFacadeLocal"), AdministrationFacadeLocalLocalHome.class);
				adminFacadeHome = ( AdministrationFacadeHome ) PortableRemoteObject.narrow
						( context.lookup("ejb/AdministrationFacadeLocal"), AdministrationFacadeHome.class);
				return adminFacadeHome.create();
    }
		catch(Exception ex) 
		{
			System.err.println("/******** TDSUB - cwsub");
			ex.printStackTrace();
			System.err.println("TDSUB - cwsub ********/");
			return null;
    }
  }
  

  

}